import {createRouter, createWebHistory} from 'vue-router'
import HomeView from '../views/HomeView.vue'
import LoginPart from "@/views/login/LoginPart";
const routes = [
  {
    path: '/HomeView',
    name: 'HomeView',
    component: HomeView,
  },
  {
    path: '/LoginPart',
    name: 'LoginPart',
    component: LoginPart
  },
  {
    path: '',
    redirect:'/HomeView'
  },
  {
    path: '/MyInfo',
    name: 'MyInfo',
    component: () => import ('@/views/MyInfo')
  },
  {
    path: '/OrderInfo',
    name: 'OrderInfo',
    component: () => import ('@/views/OrderInfo')
  },
  {
    path: '/FindInfo',
    name: 'FindInfo',
    component: () => import ('@/views/FindInfo')
  },
  {
    path: '/BusinessListPart',
    name: 'BusinessListPart',
    component: () => import ('@/views/BusinessListPart/BusinessListPart'),
    children:[
      {
        path:'',
        name:'BusinessListIndex',
        component: () => import ('@/views/BusinessListPart/BusinessListIndex')
      },
      {
        path:'BusinessDetail/:shopId',
        name:'BusinessDetail',
        component: () => import ('@/views/BusinessListPart/BusinessDetail')
      },
    ]
  },
  {
    path:'/order-confirm/:shopId',
    name:'orderConfirm',
    component: () => import ('@/views/userOrder/OrderConfirm')
  },
  {
    path: '/pay-money/:shopId',
    name:'payMoney',
    component: () => import ('@/views/userOrder/PayMoney')
  },
  {
    path: '/address-control',
    name:'addressControl',
    component: () => import ('@/views/address/AddressControl')
  },
  {
    path: '/RegisterPart',
    name: 'RegisterPart',
    component: () => import ('@/views/login/RegisterPart')
  },
  {
    path: '/update-address/:id',
    name:'updateAddress',
    component: () => import('@/views/address/UpdateAddress')
  },
  {
    path: '/add-address/:userId',
    name:'addAddress',
    component: () => import('@/views/address/AddAddress')
  },
  {
    path: '/business-home',
    name:'businessHome',
    component: () => import('@/views/businessOrder/BusinessHome')
  },
  {
    path: '/order-detail',
    name:'orderDetail',
    component: () => import('@/views/userOrder/OrderDetail')
  },
  {
    path: '/add-shop/:businessId',
    name:'addShop',
    component: () => import('@/views/shop/AddShop')
  },
  {
    path: '/shop-detail/:id',
    name:'shopDetail',
    component: () => import('@/views/shop/ShopDetail')
  },
  {
    path: '/add-food/:shopId',
    name:'addFood',
    component: () => import('@/views/shop/AddFood')
  },
  {
    path: '/business-order/:shopId',
    name:'businessOrder',
    component: () => import('@/views/businessOrder/BusinessOrder')
  }
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
